@@ -53,7 +53,7 @@ class UserInfo(BaseModelMixin): |
||
53 | 53 |
def data(self): |
54 | 54 |
try: |
55 | 55 |
user = IsolationPointUserInfo.objects.get(user_id=self.user_id, status=True).userdata |
56 |
- except: |
|
56 |
+ except IsolationPointUserInfo.DoesNotExist: |
|
57 | 57 |
user = {} |
58 | 58 |
|
59 | 59 |
return { |
@@ -2,11 +2,10 @@ |
||
2 | 2 |
|
3 | 3 |
from __future__ import division |
4 | 4 |
|
5 |
-from django_logit import logit |
|
6 | 5 |
from django_response import response |
7 | 6 |
from TimeConvert import TimeConvert as tc |
8 | 7 |
|
9 |
-from equipment.models import IsolationPointUserInfo, AntigenMeasureLogInfo |
|
8 |
+from equipment.models import AntigenMeasureLogInfo, IsolationPointUserInfo |
|
10 | 9 |
|
11 | 10 |
|
12 | 11 |
def upload_antigen(request): |
@@ -20,12 +19,13 @@ def upload_antigen(request): |
||
20 | 19 |
|
21 | 20 |
try: |
22 | 21 |
user = IsolationPointUserInfo.objects.get(fields__icontains=phone, status=True) |
23 |
- user.detect_at = detect_at |
|
24 |
- user.antigen_result = result |
|
25 |
- user.save() |
|
26 | 22 |
except IsolationPointUserInfo.DoesNotExist: |
27 | 23 |
user = None |
28 | 24 |
|
25 |
+ user.detect_at = detect_at |
|
26 |
+ user.antigen_result = result |
|
27 |
+ user.save() |
|
28 |
+ |
|
29 | 29 |
AntigenMeasureLogInfo.objects.create( |
30 | 30 |
point_id=user.point_id if user else '', |
31 | 31 |
user_id=user.user_id if user else '', |
@@ -9,7 +9,8 @@ from django_response import response |
||
9 | 9 |
from paginator import pagination |
10 | 10 |
from TimeConvert import TimeConvert as tc |
11 | 11 |
|
12 |
-from equipment.models import IsolationPointInfo, IsolationPointUserInfo, ThermometerEquipmentInfo, ThermometerMeasureLogInfo |
|
12 |
+from equipment.models import (IsolationPointInfo, IsolationPointUserInfo, ThermometerEquipmentInfo, |
|
13 |
+ ThermometerMeasureLogInfo) |
|
13 | 14 |
from utils.error.errno_utils import IsolationPointStatusCode |
14 | 15 |
|
15 | 16 |
|
@@ -127,22 +128,19 @@ def mp_upload_temperature(request): |
||
127 | 128 |
ipui = IsolationPointUserInfo.objects.get(user_id=userid, status=True) |
128 | 129 |
except IsolationPointUserInfo.DoesNotExist: |
129 | 130 |
ThermometerMeasureLogInfo.objects.create(point_id='', macid=macid, user_id=userid, temperature=temperature, temperature_src=ThermometerMeasureLogInfo.MP, chg_sta=False, ignore_temperature=False, ignore_fever_temperature=False, upload_temperature_info='') |
130 |
- |
|
131 | 131 |
return response() |
132 | 132 |
|
133 |
- |
|
134 | 133 |
ThermometerMeasureLogInfo.objects.create(point_id=ipui.point_id, macid=macid, user_id=userid, temperature=temperature, temperature_src=ThermometerMeasureLogInfo.MP, chg_sta=False, ignore_temperature=False, ignore_fever_temperature=False, upload_temperature_info='') |
135 | 134 |
|
136 | 135 |
ipui.observed_ymds = list(set(ipui.observed_ymds + [tc.local_string(format='%Y-%m-%d')])) |
137 | 136 |
ipui.observed_days = len(ipui.observed_ymds) |
138 | 137 |
ipui.temperature = temperature |
139 |
- |
|
140 | 138 |
ipui.last_submit_at = tc.utc_datetime() |
141 |
- |
|
142 | 139 |
ipui.save() |
143 | 140 |
|
144 | 141 |
return response() |
145 | 142 |
|
143 |
+ |
|
146 | 144 |
@logit |
147 | 145 |
def mp_temperature_list(request): |
148 | 146 |
user_id = request.POST.get('user_id', '') |
@@ -156,13 +154,13 @@ def mp_temperature_list(request): |
||
156 | 154 |
|
157 | 155 |
logs = [log.userdata for log in logs] |
158 | 156 |
|
159 |
- |
|
160 | 157 |
return response(data={ |
161 | 158 |
'logs': logs, |
162 | 159 |
'left': left, |
163 | 160 |
'count': count, |
164 | 161 |
}) |
165 | 162 |
|
163 |
+ |
|
166 | 164 |
def admin_user_results(request): |
167 | 165 |
point_id = request.POST.get('point_id', '') |
168 | 166 |
kw = request.POST.get('kw', '') |
@@ -173,7 +171,7 @@ def admin_user_results(request): |
||
173 | 171 |
|
174 | 172 |
if kw: |
175 | 173 |
ipuis = ipuis.filter(fields__icontains=kw) |
176 |
- |
|
174 |
+ |
|
177 | 175 |
total_active_eqpt_num = ipuis.count() |
178 | 176 |
ipuis, left = pagination(ipuis, page, num) |
179 | 177 |
|
@@ -191,6 +189,7 @@ def admin_user_results(request): |
||
191 | 189 |
'fever_num': fever_num, |
192 | 190 |
}) |
193 | 191 |
|
192 |
+ |
|
194 | 193 |
@logit |
195 | 194 |
def admin_point_user_unbind(request): |
196 | 195 |
user_id = request.POST.get('user_id', '') |
@@ -200,7 +199,7 @@ def admin_point_user_unbind(request): |
||
200 | 199 |
ipui = IsolationPointUserInfo.objects.get(user_id=user_id, status=True) |
201 | 200 |
except IsolationPointUserInfo.DoesNotExist: |
202 | 201 |
return response() |
203 |
- |
|
202 |
+ |
|
204 | 203 |
ipui.leave_at = tc.utc_datetime() |
205 | 204 |
ipui.status = False |
206 | 205 |
ipui.remark = '' |
@@ -208,12 +207,13 @@ def admin_point_user_unbind(request): |
||
208 | 207 |
|
209 | 208 |
try: |
210 | 209 |
eqpt = ThermometerEquipmentInfo.objects.get(ipui_pk=ipui.pk, status=True) |
211 |
- eqpt.active_status = active |
|
212 |
- eqpt.ipui_pk = 0 |
|
213 |
- eqpt.save() |
|
214 |
- except: |
|
210 |
+ except ThermometerEquipmentInfo.DoesNotExist: |
|
215 | 211 |
return response() |
216 | 212 |
|
213 |
+ eqpt.active_status = active |
|
214 |
+ eqpt.ipui_pk = 0 |
|
215 |
+ eqpt.save() |
|
216 |
+ |
|
217 | 217 |
return response() |
218 | 218 |
|
219 | 219 |
|
@@ -227,10 +227,10 @@ def admin_point_user_remark(request): |
||
227 | 227 |
ipui = IsolationPointUserInfo.objects.get(user_id=user_id, status=True) |
228 | 228 |
except IsolationPointUserInfo.DoesNotExist: |
229 | 229 |
return response() |
230 |
- if ipui: |
|
231 |
- ipui.remark = remark |
|
232 |
- ipui.remarks += [remark] |
|
233 |
- ipui.save() |
|
230 |
+ |
|
231 |
+ ipui.remark = remark |
|
232 |
+ ipui.remarks += [remark] |
|
233 |
+ ipui.save() |
|
234 | 234 |
|
235 | 235 |
return response() |
236 | 236 |
|
@@ -248,7 +248,6 @@ def admin_point_user_temperature_history(request): |
||
248 | 248 |
|
249 | 249 |
logs = [log.data for log in logs] |
250 | 250 |
|
251 |
- |
|
252 | 251 |
return response(data={ |
253 | 252 |
'logs': logs, |
254 | 253 |
'left': left, |
@@ -2,8 +2,8 @@ |
||
2 | 2 |
|
3 | 3 |
from django.conf.urls import url |
4 | 4 |
|
5 |
-from api import (admin_views, aep_views, eqpt_views, field_views, mini_views, oauth_views, point_views, screen_views, |
|
6 |
- wx_views, antigen_views) |
|
5 |
+from api import (admin_views, aep_views, antigen_views, eqpt_views, field_views, mini_views, oauth_views, point_views, |
|
6 |
+ screen_views, wx_views) |
|
7 | 7 |
|
8 | 8 |
|
9 | 9 |
urlpatterns = [ |
@@ -3,8 +3,9 @@ |
||
3 | 3 |
from django.contrib import admin |
4 | 4 |
from django_admin import ReadOnlyModelAdmin |
5 | 5 |
|
6 |
-from equipment.models import (AepThermometerMeasureLogInfo, IsolationPointFieldPoolInfo, IsolationPointInfo, |
|
7 |
- IsolationPointUserInfo, ThermometerEquipmentInfo, ThermometerMeasureLogInfo, AntigenMeasureLogInfo) |
|
6 |
+from equipment.models import (AepThermometerMeasureLogInfo, AntigenMeasureLogInfo, IsolationPointFieldPoolInfo, |
|
7 |
+ IsolationPointInfo, IsolationPointUserInfo, ThermometerEquipmentInfo, |
|
8 |
+ ThermometerMeasureLogInfo) |
|
8 | 9 |
|
9 | 10 |
|
10 | 11 |
class IsolationPointFieldPoolInfoAdmin(admin.ModelAdmin): |
@@ -12,7 +13,7 @@ class IsolationPointFieldPoolInfoAdmin(admin.ModelAdmin): |
||
12 | 13 |
|
13 | 14 |
|
14 | 15 |
class IsolationPointInfoAdmin(admin.ModelAdmin): |
15 |
- list_display = ('point_id', 'point_name', 'point_fields', 'point_upload_period', 'limit_scene_qrcode_url', 'status', 'created_at', 'updated_at') |
|
16 |
+ list_display = ('point_id', 'point_name', 'point_fields', 'point_upload_period', 'temperature_measure_type', 'limit_scene_qrcode_url', 'status', 'created_at', 'updated_at') |
|
16 | 17 |
|
17 | 18 |
|
18 | 19 |
class IsolationPointUserInfoAdmin(admin.ModelAdmin): |
@@ -1,12 +1,13 @@ |
||
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
|
3 |
+import datetime |
|
4 |
+ |
|
3 | 5 |
from django.db import models |
4 | 6 |
from django.utils.translation import ugettext_lazy as _ |
5 | 7 |
from django_models_ext import BaseModelMixin, SexModelMixin |
6 | 8 |
from jsonfield import JSONField |
7 | 9 |
from shortuuidfield import ShortUUIDField |
8 | 10 |
from TimeConvert import TimeConvert as tc |
9 |
-import datetime |
|
10 | 11 |
|
11 | 12 |
from utils.redis.rqrurl import get_qrcode_url |
12 | 13 |
|